package net.board.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.board.db.BoardDAO;
import net.board.db.BoardBean;

public class BoardReplyAction implements Action {
	 public ActionForward execute(HttpServletRequest request,HttpServletResponse response) 
	 throws Exception{
		 	
		 	request.setCharacterEncoding("UTF-8");
			response.setCharacterEncoding("UTF-8");
			response.setContentType("text/html; charset=UTF-8");
		 	
			System.out.println("리플액션!!!입장");
			ActionForward forward = new ActionForward();
		 	
			BoardDAO boarddao=new BoardDAO();
	   		BoardBean boarddata=new BoardBean();
	   		int result=0;
	   		
	   		int number = Integer.parseInt(request.getParameter("number"));
	   		//System.out.println("넘어온 number(1):"+number);
	   		
	   		boarddata.setMember_Id(boarddao.idGet(request.getParameter("QNA_NICK")));
	   		boarddata.setQNA_NICK(request.getParameter("qna_Nick"));
	   		boarddata.setQNA_PASS(request.getParameter("QNA_PASS"));
	   		boarddata.setQNA_SUBJECT(request.getParameter("QNA_SUBJECT"));
	   		boarddata.setQNA_CONTENT(request.getParameter("QNA_CONTENT"));
	   		boarddata.setQNA_REF(Integer.parseInt(request.getParameter("QNA_REF")));
	   		boarddata.setQNA_LEV(Integer.parseInt(request.getParameter("QNA_LEV")));
	   		boarddata.setQNA_SEQ(Integer.parseInt(request.getParameter("QNA_SEQ")));
	   		
	   		
	   		result=boarddao.boardReply(boarddata);
	   		
	   		if(result==0){
	   			return null;
	   		}
	   		
	   		forward.setRedirect(true);
	   		forward.setPath("./BoardDetailAction.bo?ID="+result+"&number=3");
	   		return forward;
	}  	
}